/*
{
    create: [updateClass, updateAttr, updateStyle],
    update: [updateClass, updateAttr, updateStyle]
}
这里的hooks需要在创建vdom就给加上, 这样创建真实的元素的时候可以访问到这里的hooks。
*/
import attrsHooks from './attrs';
import classHooks from './class'
import show from './directives/show';
import eventsHooks from './events';
import ref from './ref';
import styleHooks  from './style';
export const hooks = {
    create: [],
    update: []
};
function registerHook(hooks, moduleHook){
    const keys = Object.keys(hooks);
    for (let i=0; i<keys.length; i++){
        const hookName = keys[i];
        const hookDef = moduleHook[hookName];
        if (classHooks[hookName]){
            hooks[hookName].push(hookDef);
        }
    }
}
registerHook(hooks, classHooks);
registerHook(hooks, styleHooks);
registerHook(hooks, attrsHooks);
registerHook(hooks, eventsHooks);
registerHook(hooks, show);
registerHook(hooks, ref);